home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Pascal / Snippets / ResForkUtilities / ResForkUtilities.p < prev   
Encoding:
Text File  |  1992-11-15  |  39.8 KB  |  1,030 lines  |  [TEXT/R*ch]

  1. {****************************************************    }
  2. {                                                                                                                            }
  3. {        ResForkUtilities.p                                                                                            }
  4. {                                                                                                                            }
  5. {        Written by: Keith R. Dunleavy                                                                        }
  6. {        (kdunleav@student.med.harvard.edu)                                                                }
  7. {                                                                                                                            }
  8. {        Code history:                                                                                                }
  9. {        Written for use with Symantec THINK Pascal 4.0 (Object Oriented)                }
  10. {        First created as Version 1.0 on 4/17/92                                                        }
  11. {        Icon plotting code added on 5/11/92                                                                }
  12. {                                                                                                                            }
  13. {        A conglomeration of Resource Fork utilities.                                                    }
  14. {                                                                                                                            }
  15. {        ACKNOWLEDGEMENTS:                                                                                    }
  16. {    *    Code used for the plotting of icons was translated from Patrick C. Beard's        }
  17. {        C coded "ShowIconFamily" source (modified by: James W. Walker).                }
  18. {    *    Code used for the obtainment of application version information was                }
  19. {        inspired by Apple's Developer Technical Support Notes #189                         }
  20. {        "Version Territory"                                                                                        }
  21. {                                                                                                                            }
  22. {        COMMENTS:                                                                                                    }
  23. {        There are certainly ways to code these methods more efficiently. For            }
  24. {        instance, the seperate methods for PlotSmall and PlotLarge icons could be         }
  25. {        combined with some parameter passed in to make the necessary calcs            }
  26. {        which are different between the two resource formats. Nevertheless...            }
  27. {        these methods were written with the intent of helping out those who,                }
  28. {        like I was, are grapling with the tasks of mapping "things" to PixMaps.            }
  29. {        For a while I could find nobody who had concrete code for doing a color            }
  30. {        mapping to the screen. Eventually I got some good tips though.                         }
  31. {        So... I included the fruits of these tips, and some other resource handlers        }
  32. {        for your enjoyment. I hope that they're helpfull. This is certainly                     }
  33. {        EducationWare and is no big deal. If you do write a program that uses these    }
  34. {        methods 8.7 gazillion times... please just mention it.                                        }
  35. {                                                                                                                            }
  36. {        CORRECTIONS:                                                                                                }
  37. {        Things can always be coded better. People usually make mistakes. So please,    }
  38. {        if you have any suggestions, corrections, questions, or even some helpful        }
  39. {        resource handler methods of your own... don't hesitate to drop me some            }
  40. {        EMail at the above address.                                                                            }
  41. {****************************************************    }
  42.  
  43. unit ResForkUtilities;
  44.  
  45. interface
  46.  
  47.  
  48. {*********************************************************************    }
  49. {*                                                            U T I L I T Y    C O N S T A N T S                                                    *    }
  50. {*********************************************************************    }
  51.     const
  52.         MaxPossibleDepth = 8;                        {    The maximum resource depth to check is 8 bits    }
  53.         SmallIconSide = 16;                            {    The size of the "small icon" family is 16x16.        }
  54.         LargeIconSide = 32;                            {    The size of the "Large icon" family is 32x32.    }
  55.  
  56. {*********************************************************************    }
  57. {*                                                                    U T I L I T Y    T Y P E S                                                          *    }
  58. {*********************************************************************    }
  59.     type
  60.  
  61.         {     Resource Version Template }
  62.         {    Taken from Developer Technical Support Notes #189 "Version Territory"    }
  63.         NumVersion = packed record
  64.                 case integer of
  65.                     0: (
  66.                             majorRev: SignedByte;        {    1st part of version number in BCD    }
  67.                             minorRev: 0..9;                {    2nd part is 1 nibble in BCD    }
  68.                             bugFixRev: 0..9;                {    3rd part is 1 nibble in BCD    }
  69.                             stage: signedByte;            {    stage code: dev, alpha, beta, final    }
  70.                             nonRelRev: signedByte        {    revision level of non-released version    }
  71.                     );
  72.                     1: (
  73.                             version: LongInt                {    to use all 4 fields at one time    }
  74.                     );
  75.             end;
  76.  
  77.         VersRecPtr = ^VersRec;
  78.         VersRecHandl = ^VersRecPtr;
  79.         VersRec = record
  80.                 numericalVersion: NumVersion;        {    encoded version number    }
  81.                 countryCode: integer;                    {    country code from intl utilities    }
  82.                 shortVersion: str255;                    {    version number string - worst case    }
  83.                 longVersion: str255;                        {    LongMessage string packed after shortVersion    }
  84.             end;
  85.  
  86.         {    Special BitMap pointer used for convincing CopyBits that it     }
  87.         {    is receiving a BitMap when it is infact receiving a PixMap.        }
  88.         BitMapPtr = ^BitMap;
  89.  
  90. {*********************************************************************    }
  91. {*                                                            U T I L I T Y    I N T E R F A C E S                                                    *    }
  92. {*********************************************************************    }
  93.  
  94.     function GetScreenDepth: Integer;
  95.  
  96.     procedure GetIndCLUT (var theColor: RGBColor; theCLUTRsrcID, theCLUTRsrcIndex: integer);
  97.  
  98.     function GetVersionString (var LVersionString, SVersionString: str255): Boolean;
  99.  
  100.     function GetSmallIcon (SmallIconID: Integer; var suggestedDepth: Integer): Handle;
  101.     procedure PlotBWSmallIcon (BWSmallIcon: Handle; location: Point);
  102.     procedure PlotCSmallIcon (CSmallIcon: Handle; SmallIconMaskID, Depth: integer; location: Point);
  103.     procedure PlotSmallIcon (SmallIconID, DesiredDepth: integer; location: Point);
  104.  
  105.     function GetLargeIcon (LargeIconID: Integer; var suggestedDepth: Integer): Handle;
  106.     procedure PlotBWLargeIcon (BWLargeIcon: Handle; location: Point);
  107.     procedure PlotCLargeIcon (CLargeIcon: Handle; LargeIconMaskID, Depth: integer; location: Point);
  108.     procedure PlotLargeIcon (LargeIconID, DesiredDepth: integer; location: Point);
  109.  
  110. implementation
  111.  
  112.  
  113. {*********************************************************************    }
  114. {*                                                                U T I L I T Y      M E T H O D S                                                     *    }
  115. {*********************************************************************    }
  116.  
  117.  
  118. {-----------------------------------------------------------    }
  119. {    GetScreenDepth --                                                                    }
  120. {                                                                                                    }
  121. {        This function returns the current screen depth.                        }
  122. {-----------------------------------------------------------    }
  123.     function GetScreenDepth: Integer;
  124.         var
  125.             environment: SysEnvRec;
  126.             theMainDevice: GDHandle;
  127.             anError: OSErr;
  128.             theDepth: Integer;
  129.     begin
  130.  
  131.         {    Determine the system environment.    }
  132.         anError := SysEnvirons(curSysEnvVers, environment);
  133.  
  134.         {    Check to make sure that the system supports color QuickDraw.    }
  135.         if environment.hasColorQD then
  136.             begin
  137.                 {    Get a handle to the main device.    }
  138.                 theMainDevice := GetMainDevice;
  139.                 {    Determine the current depth being used.    }
  140.                 theDepth := theMainDevice^^.gdPMap^^.pixelSize;
  141.                 {    Check if the depth is set as being less than 4. If so, we want        }
  142.                 {    only possible icon depths (1,4,8) so set it to the next lowest.    }
  143.                 if theDepth < 4 then
  144.                     theDepth := 1;
  145.             end
  146.         else
  147.             {    The environment indicated that the current system does not    }
  148.             {    support color quickDraw, and thus we are dealing with a        }
  149.             {    monochrome system. Ultimately, this means a depth of 1.        }
  150.             theDepth := 1;
  151.  
  152.         {    Return the function value.    }
  153.         GetScreenDepth := theDepth;
  154.  
  155.     end;
  156. {-------------------------------------------    }
  157. {    End of function GetScreenDepth                            }
  158. {-------------------------------------------    }
  159.  
  160.  
  161. {*********************************************************************    }
  162. {*                        C O L O R   L O O K - U P   T A B L E   (clut)  H A N D L I N G      M E T H O D S                         *    }
  163. {*********************************************************************    }
  164.  
  165.  
  166. {-----------------------------------------------------------    }
  167. {    GetIndCLUT --                                                                            }
  168. {                                                                                                    }
  169. {        Return the RGBColor found at a given index in a given                }
  170. {        clut resource.                                                                        }
  171. {-----------------------------------------------------------    }
  172.     procedure GetIndCLUT (var theColor: RGBColor; theCLUTRsrcID, theCLUTRsrcIndex: integer);
  173.         var
  174.             aCTabHandle: CTabHandle;
  175.     begin
  176.  
  177.         {    Obtain the color look up table.    }
  178.         aCTabHandle := GetCTable(theCLUTRsrcID);
  179.         {    Check to make sure that the color look-up table could be found.    }
  180.         if aCTabHandle <> nil then
  181.  
  182.             {    Now that we are sure that we have found a clut, make sure that    }
  183.             {    the requested index is within the legal range for this clut.            }
  184.             {    Keep in mind that all cluts are zero based arrays.                        }
  185.             if ((theCLUTRsrcIndex >= 0) and (theCLUTRsrcIndex <= aCTabHandle^^.ctSize)) then
  186.  
  187.                 begin
  188.  
  189.                     {    Lock down its handle.    }
  190.                     HLock(Handle(aCTabHandle));
  191.  
  192.                     {    Set the value of the color retreived.    }
  193.                     theColor := aCTabHandle^^.ctTable[theCLUTRsrcIndex].rgb;
  194.  
  195.                     {    Unlock the handle.    }
  196.                     HUnlock(Handle(aCTabHandle));
  197.  
  198.                     {    Release the handle.    }
  199.                     ReleaseResource(Handle(aCTabHandle));
  200.  
  201.                 end;
  202.     end;
  203. {-------------------------------------------    }
  204. {    End of procedure GetIndCLUT                                }
  205. {-------------------------------------------    }
  206.  
  207.  
  208. {*********************************************************************    }
  209. {*                                            V E R S I O N   (vers)  H A N D L I N G      M E T H O D S                                     *    }
  210. {*********************************************************************    }
  211.  
  212.  
  213. {-----------------------------------------------------------    }
  214. {    GetVersionString --                                                                    }
  215. {                                                                                                    }
  216. {    This function returns the value of various version labels.            }
  217. {    Which are stored in the resource fork of the application.            }
  218. {    The version resource must be located at ID = 1.                            }
  219. {    If the function could not (for whatever reason) obtain the             }
  220. {    version information, the function's value is returned as FALSE    }
  221. {-----------------------------------------------------------    }
  222.     function GetVersionString (var LVersionString, SVersionString: str255): Boolean;
  223.         const
  224.             VersionRsrcID = 1;                {    the resource ID number    }
  225.         var
  226.             Successful: Boolean;                {    flag for determining whether or not the obtaining of the vers info was succesful    }
  227.             aHandle: Handle;
  228.             VersionPtr: VersRecPtr;
  229.     begin
  230.  
  231.         {    prime the returned flag... lets be optimistic.    }
  232.         Successful := TRUE;
  233.  
  234.         {    our first job is to get version information from the resource template "vers"    }
  235.  
  236.         aHandle := GetResource('vers', VersionRsrcID);        { Load resource into memory    }
  237.  
  238.         {    check to see if the resource was indeed returned.    }
  239.         if aHandle <> nil then
  240.             begin
  241.  
  242.                 { Lock resource in heap            }
  243.                 HLock(aHandle);
  244.  
  245.                 {    Get a type casted version the handle's pointer    }
  246.                 VersionPtr := VersRecPtr(aHandle^);
  247.  
  248.                 {    extract the actual two strings of info which we want.    }
  249.                 SVersionString := VersionPtr^.shortVersion;
  250.                 LVersionString := VersionPtr^.longVersion;
  251.  
  252.                 { Unlock resource    }
  253.                 HUnlock(aHandle);
  254.  
  255.                 {    alow the resource to be purged.    }
  256.                 ReleaseResource(aHandle);
  257.  
  258.             end
  259.         else
  260.             {    if we were unable to obtain a handle to the resource information    }
  261.             {    return a value of FALSE.                                                                }
  262.             Successful := FALSE;
  263.  
  264.         {    return the function value.    }
  265.         GetVersionString := Successful;
  266.  
  267.     end;
  268. {-------------------------------------------    }
  269. {    End of function GetVersionString                        }
  270. {-------------------------------------------    }
  271.  
  272.  
  273. {*********************************************************************    }
  274. {*                                        S M A L L    I C O N   (icsx)  H A N D L I N G      M E T H O D S                                 *    }
  275. {*********************************************************************    }
  276.  
  277.  
  278.  
  279. {-----------------------------------------------------------    }
  280. {    GetSmallIcon --                                                                            }
  281. {                                                                                                    }
  282. {        This function returns a handle the "deepest" possible small    }
  283. {        icon it can find. This will be either a ics8, ics4, or ics#.        }
  284. {        The function starts searching for the icon which coresponds    }
  285. {        to the "suggestedDepth" and, if not found, will search for        }
  286. {        a SmallIcon of the same ID, but lower depth.                            }
  287. {        EXAMPLE: The function is called, looking for a small icon of    }
  288. {        ID=200. The suggestedDepth is 8. The function looks for a        }
  289. {        ics8 resource of ID=200. If found, its handle is returned. If    }
  290. {        it can't be located, the next logical depth to search is 4.            }
  291. {        Thus the function then looks for a ics4 of ID=200. If found,     }
  292. {        a handle to the ics4 is returned. If not found, on last attempt    }
  293. {        will be made to locate a usable SmallIcon. This time, the        }
  294. {        search will be for a depth of 1. Thus the function looks for        }
  295. {        a ics# of ID=200. Again, if found, the handle to the icon is        }
  296. {        returned. If no SmallIcon is found, then a nil is returned.        }
  297. {-----------------------------------------------------------    }
  298.     function GetSmallIcon (SmallIconID: Integer; var suggestedDepth: Integer): Handle;
  299.         var
  300.             SmallIconH: Handle;
  301.             ActualDepth: Integer;
  302.     begin
  303.  
  304.         {    Prime the local variables.    }
  305.         SmallIconH := nil;
  306.         ActualDepth := suggestedDepth;
  307.  
  308.         {    If the suggested depth is 8 bits (or mistakenly more) then    }
  309.         {    search for an ics8 resource.                                                }
  310.         if suggestedDepth >= 8 then
  311.             begin
  312.                 SmallIconH := GetResource('ics8', SmallIconID);
  313.                 {    If the resource was indeed present, then }
  314.                 if SmallIconH <> nil then
  315.                     begin
  316.                         {    Make sure that the suggestedDepth is set to reflect the     }
  317.                         {    small icons which was actually located.                            }
  318.                         suggestedDepth := 8;
  319.                     end
  320.                 else
  321.                     {    No ics8 resource could be found at the given ID. Thus, set    }
  322.                     {    set the suggestedDepth to the next lowest depth.                }
  323.                     suggestedDepth := 4;
  324.             end;
  325.  
  326.         {    If the suggested depth is 4 bits (or mistakenly 5-7), and no smallIcon    }
  327.         {    has yet been located, then search for an ics4 resource.                        }
  328.         if ((suggestedDepth < 8) and (suggestedDepth >= 4) and (SmallIconH = nil)) then
  329.             begin
  330.                 SmallIconH := GetResource('ics4', SmallIconID);
  331.                 {    If the resource was indeed present, then }
  332.                 if SmallIconH <> nil then
  333.                     begin
  334.                         {    Make sure that the suggestedDepth is set to reflect the     }
  335.                         {    small icons which was actually located.                            }
  336.                         suggestedDepth := 4;
  337.                     end
  338.                 else
  339.                     {    No ics4 resource could be found at the given ID. Thus, set    }
  340.                     {    set the suggestedDepth to the next lowest depth.                }
  341.                     suggestedDepth := 1;
  342.             end;
  343.  
  344.         {    If the suggested depth is 1 bit (or mistakenly 2-3), and no smallIcon    }
  345.         {    has yet been located, then search for an ics# resource.                        }
  346.         if ((suggestedDepth < 4) and (SmallIconH = nil)) then
  347.             begin
  348.                 SmallIconH := GetResource('ics#', SmallIconID);
  349.                 {    If the resource was indeed present, then }
  350.                 if SmallIconH <> nil then
  351.                     begin
  352.                         {    Make sure that the suggestedDepth is set to reflect the     }
  353.                         {    small icons which was actually located.                            }
  354.                         suggestedDepth := 1;
  355.                     end
  356.                 else
  357.                     {    No ics# resource could be found at the given ID. Thus, set    }
  358.                     {    set the suggestedDepth to the next lowest depth.                }
  359.                     suggestedDepth := 0;
  360.             end;
  361.  
  362.         {    Return the handle to the SmallIcon.    }
  363.         {    If it is nil, then no smallIcon was found. Also if this is    }
  364.         {    true, the suggestedDepth var parameter will be set to zero.    }
  365.         GetSmallIcon := SmallIconH;
  366.  
  367.     end;
  368. {-------------------------------------------    }
  369. {    End of function GetSmallIcon                                }
  370. {-------------------------------------------    }
  371.  
  372.  
  373. {-----------------------------------------------------------    }
  374. {    PlotBWSmallIcon --                                                                    }
  375. {                                                                                                    }
  376. {        This procedure draws the ics# member of a SmallIcon            }
  377. {        family. This drawing is done in the current grafPort, with        }
  378. {        the upper left corner of the SmallIcon being located at the        }
  379. {        desired point.                                                                        }
  380. {                                                                                                    }
  381. {    *    For Reference:                                                                        }
  382. {        An ics# is a resource type which defines a 16 by 16 pixel     }
  383. {        black&white image of 1 bit depth, and thus a total of 32         }
  384. {        bytes. It is also followed by the ics# mask or 32 bytes.            }
  385. {-----------------------------------------------------------    }
  386.     procedure PlotBWSmallIcon (BWSmallIcon: Handle; location: Point);
  387.         var
  388.             Bounds: Rect;
  389.             DestRect: Rect;
  390.             BWSmallIconBitMap: BitMap;
  391.  
  392.     begin
  393.  
  394.         { Determine the bounds and destination rect of the smallIcon according to the passed in location parameter . }
  395.         SetRect(bounds, 0, 0, SmallIconSide, SmallIconSide);
  396.         SetRect(destRect, location.h, location.v, location.h + SmallIconSide, location.v + SmallIconSide);
  397.  
  398.         {    Lock down our SmallIcon.    }
  399.         HLock(BWSmallIcon);
  400.  
  401.         {    Prepare the SmallIcon Mask and destination bitmaps.    }
  402.         BWSmallIconBitMap.baseAddr := Ptr(LongInt(BWSmallIcon^) + 32);
  403.         BWSmallIconBitMap.rowBytes := 2;
  404.         BWSmallIconBitMap.bounds := Bounds;
  405.  
  406.         {    Transfer the mask of the B&W SmallIcon.    }
  407.         CopyBits(BWSmallIconBitMap, thePort^.PortBits, bounds, DestRect, srcBic, nil);
  408.  
  409.         {    Change the BitMap address pointer to get the ics# image as apposed to the current mask.    }
  410.         BWSmallIconBitMap.baseAddr := Ptr(BWSmallIcon^);
  411.         {    Transfer the SmallIcon image.    }
  412.         CopyBits(BWSmallIconBitMap, thePort^.PortBits, bounds, DestRect, srcOr, nil);
  413.  
  414.         {    UnLock our SmallIcon.    }
  415.         HUnLock(BWSmallIcon);
  416.  
  417.     end;
  418. {-------------------------------------------    }
  419. {    End of procedure PlotBWSmallIcon                        }
  420. {-------------------------------------------    }
  421.  
  422.  
  423.  
  424. {-----------------------------------------------------------    }
  425. {    PlotCSmallIcon --                                                                        }
  426. {                                                                                                    }
  427. {    *    This procedure draws the "deepest" color small icon it can.    }
  428. {        This is based on the determined depth of screen as well as        }
  429. {        available resources.                                                                }
  430. {    *    Once the small icon is identified and loaded, it is transfered    }
  431. {        to a PixelMap of either 4 or 8 bit depth, depending on             }
  432. {        whether it is an ics4 or ics8.                                                    }
  433. {    *    The small icon is drawn with its upper left corner situated        }
  434. {        at the desired location within the current grafCPort.                }
  435. {                                                                                                    }
  436. {    *    For Reference:                                                                        }
  437. {    *    An ics8 is a resource type which defines a 16 by 16 pixel         }
  438. {        color image of 8 bit depth, and thus a total of 256 bytes.        }
  439. {    *    An ics4 is a resource type which defines a 16 by 16 pixel         }
  440. {        color image of 4 bit depth, and thus a total of 128 bytes.        }
  441. {    *    An ics# is a resource type which defines a 16 by 16 pixel     }
  442. {        black&white image of 1 bit depth, and thus a total of 32         }
  443. {        bytes. It is also followed by the ics# mask or 32 bytes.            }
  444. {-----------------------------------------------------------    }
  445.     procedure PlotCSmallIcon (CSmallIcon: Handle; SmallIconMaskID, Depth: integer; location: Point);
  446.         var
  447.             ScreenDepth: Integer;                        {    Holds the determined depth of the screen.    }
  448.             SmallIconDepth: Integer;                    {    Holds the highest found Small Icon depth (either 1,4, or 8)        }
  449.                                                                     {    If no Small Icon can be found, then this holds the value zero.    }
  450.             ColorLookUpTable: CTabHandle;            {    Holds our own color look-up table.    }
  451.             destRect: Rect;                                    {    The rect which holds the end location of the small icon.    }
  452.             MaskIconHandle: Handle;                    {    The handle which holds the small icon mask data.    }
  453.             SmallIconPixMap: PixMapHandle;        {    The color PixMap which holds the color image of the small icon.    }
  454.             SmallIconBitMap: BitMap;                    {    The B&W bitMap which holds the B&W image of the small icon.    }
  455.             MaskBitMap: BitMap;                        {    The B&W bitMap which holds the mask of the small icon.    }
  456.             bounds: Rect;                                    {    The rect which defines the bounds of the small icon.    }
  457.             rowBytes: integer;                            {    Used to hold the calculation of the number of bytes in a row of the small icon.    }
  458.             aBitMapPtr: BitMapPtr;                    {    A smecial type used to coerce the PixMap into looking like a BitMap.    }
  459.  
  460.  
  461.     {------------------------------    }
  462.     {    Set up failure handler.                }
  463.     {------------------------------    }
  464.         procedure HandleFailure (error: Integer);
  465.         begin
  466.  
  467.             {    Take care of disposal or release of all handles allocated by us.    }
  468.  
  469.             if ColorLookUpTable <> nil then
  470.                 DisposeCTable(ColorLookUpTable);
  471.  
  472.             if CSmallIcon <> nil then
  473.                 HUnLock(CSmallIcon);
  474.  
  475.             if MaskIconHandle <> nil then
  476.                 ReleaseResource(MaskIconHandle);
  477.  
  478.             if SmallIconPixMap <> nil then
  479.                 begin
  480.                     SmallIconPixMap^^.baseAddr := nil;
  481.                     DisposPixMap(SmallIconPixMap);
  482.                 end;
  483.  
  484.             Exit(PlotCSmallIcon);
  485.         end;
  486.     {------------------------------    }
  487.     {    End of failure handler.                }
  488.     {------------------------------    }
  489.  
  490.     begin
  491.  
  492.         {    Initialize all of our handles so that error handling is assured of working.    }
  493.         ColorLookUpTable := nil;
  494.         MaskIconHandle := nil;
  495.         SmallIconPixMap := nil;
  496.  
  497.         {    Check to make sure that a SmallIcon was indeed able to be found.    }
  498.         if CSmallIcon = nil then
  499.             HandleFailure(resNotFound);
  500.         {    Lock down our icon.    }
  501.         HLock(CSmallIcon);
  502.  
  503.         { Determine the bounds and destination rect of the smallIcon according to the passed in location parameter . }
  504.         SetRect(bounds, 0, 0, SmallIconSide, SmallIconSide);
  505.         SetRect(destRect, location.h, location.v, location.h + SmallIconSide, location.v + SmallIconSide);
  506.  
  507.         {    Get the mask data.        }
  508.         MaskIconHandle := GetResource('ics#', SmallIconMaskID);
  509.         {    Check to make sure that a SmallIcon mask was indeed able to be found.    }
  510.         if MaskIconHandle = nil then
  511.             HandleFailure(resNotFound);
  512.         {    Lock down our mask.    }
  513.         HLock(MaskIconHandle);
  514.  
  515.             {    Handle the plotting of a color smallIcon.    }
  516.  
  517.         {    Get the correct lookup table according to the depth of the SmallIcon.    }
  518.         ColorLookUpTable := GetCTable(Depth);
  519.         {    Check to see if the color lookUp table could be created.    }
  520.         if ColorLookUpTable = nil then
  521.             HandleFailure(memFullErr);
  522.  
  523.         {    Create a pixmap to stick the icon bits into for screen blitting.    }
  524.         SmallIconPixMap := NewPixMap;
  525.         {    Check to see if there was enough memory to create the new PixMap.    }
  526.         if SmallIconPixMap = nil then
  527.             HandleFailure(memFullErr);
  528.  
  529.         {    Set up the color pixmap with the correct bounds, depth, and clut.    }
  530.         rowBytes := (((Depth * SmallIconSide) + 15) div 16) * 2;
  531.         SmallIconPixMap^^.baseAddr := Ptr(CSmallIcon^);
  532.         SmallIconPixMap^^.rowBytes := BOR(rowBytes, $8000);
  533.         SmallIconPixMap^^.bounds := bounds;
  534.         SmallIconPixMap^^.pixelType := 0;                                {    Chunky model.    }
  535.         SmallIconPixMap^^.pixelSize := Depth;
  536.         SmallIconPixMap^^.cmpCount := 1;                                {    If in 32 bit mode this will be 3, so must change.    }
  537.         SmallIconPixMap^^.cmpSize := Depth;                            {    Only chunky images used.    }
  538.         DisposeCTable(SmallIconPixMap^^.pmTable);                    {    Dispose of default, uninitialized table.    }
  539.         SmallIconPixMap^^.pmTable := ColorLookUpTable;
  540.  
  541.         {    Prepare the SmallIcon mask.    }
  542.         MaskBitMap.baseAddr := Ptr(LongInt(MaskIconHandle^) + 32);
  543.         MaskBitMap.rowBytes := 2;
  544.         MaskBitMap.bounds := bounds;
  545.  
  546.         {    Punch out the mask.    }
  547.         CopyBits(MaskBitMap, thePort^.portBits, bounds, destRect, srcBic, nil);
  548.  
  549.         {    Draw the actual icon.    }
  550.         HLock(Handle(SmallIconPixMap));
  551.         {    In order to do this, we must disguise our PixMap as a BitMap.    }
  552.         aBitMapPtr := BitMapPtr(SmallIconPixMap^);
  553.         CopyBits(aBitMapPtr^, thePort^.portBits, bounds, destRect, srcOr, nil);
  554.  
  555.         {    Release all that we have allocated.    }
  556.         SmallIconPixMap^^.baseAddr := nil;
  557.         DisposPixMap(SmallIconPixMap);
  558.  
  559.         {    Release the mask resource handle.    }
  560.         ReleaseResource(MaskIconHandle);
  561.  
  562.         {    Unlock our icon handle.    }
  563.         HUnLock(CSmallIcon);
  564.  
  565.     end;
  566. {-------------------------------------------    }
  567. {    End of procedure PlotCSmallIcon                        }
  568. {-------------------------------------------    }
  569.  
  570.  
  571. {-----------------------------------------------------------    }
  572. {    PlotSmallIcon --                                                                        }
  573. {                                                                                                    }
  574. {    *    This procedure draws the "deepest" small icon it can.            }
  575. {        This is based on the determined depth of screen as well as        }
  576. {        available resources.                                                                }
  577. {    *    Once identified, the SmallIcon is drawn by either the                }
  578. {        PlotBWSmallIcon or PlotCSmallIcon procedures.                        }
  579. {                                                                                                    }
  580. {-----------------------------------------------------------    }
  581.     procedure PlotSmallIcon (SmallIconID, DesiredDepth: integer; Location: Point);
  582.         var
  583.             ScreenDepth: Integer;                        {    Holds the determined depth of the screen.    }
  584.             SmallIconDepth: Integer;                    {    Holds the highest found Small Icon depth (either 1,4, or 8)        }
  585.                                                                     {    If no Small Icon can be found, then this holds the value zero.    }
  586.             SmallIconHandle: Handle;                    {    The handle which holds the small icon data.    }
  587.  
  588.     {------------------------------    }
  589.     {    Set up failure handler.                }
  590.     {------------------------------    }
  591.         procedure HandleFailure (error: Integer);
  592.         begin
  593.  
  594.             {    Take care of disposal or release of all handles allocated by us.    }
  595.  
  596.             if SmallIconHandle <> nil then
  597.                 ReleaseResource(SmallIconHandle);
  598.  
  599.             Exit(PlotSmallIcon);
  600.         end;
  601.     {------------------------------    }
  602.     {    End of failure handler.                }
  603.     {------------------------------    }
  604.  
  605.     begin
  606.  
  607.         {    Initialize all of our handles so that error handling is assured of working.    }
  608.         SmallIconHandle := nil;
  609.  
  610.         {    Determine the depth of the screen.    }
  611.         ScreenDepth := GetScreenDepth;
  612.  
  613.         {    Now attempt to find the highest depth smallIcon available.    }
  614.         SmallIconDepth := ScreenDepth;
  615.         SmallIconHandle := GetSmallIcon(SmallIconID, SmallIconDepth);
  616.         {    Check to make sure that a SmallIcon was indeed able to be found.    }
  617.         if SmallIconHandle = nil then
  618.             HandleFailure(resNotFound);
  619.  
  620.         {    Now we must differentiate between the plotting of a Black&White    }
  621.         {    smallIcon and a color smallIcon.                                                        }
  622.         if SmallIconDepth > 1 then
  623.  
  624.             {    Handle the plotting of a color smallIcon.    }
  625.             {    We must send the handle to the SmallIcon, the resID of the SmallIcon's    }
  626.             {    mask (which is the ics# ID), the depth of the SmallIcon (which is            }
  627.             {    either 4 or 8), and the desired location of the upper left corner.                }
  628.             begin
  629.                 PlotCSmallIcon(SmallIconHandle, SmallIconID, SmallIconDepth, Location);
  630.             end
  631.  
  632.         else
  633.  
  634.             {    Handle the plotting of a black&White smallIcon.    }
  635.             {    We must send the handle to the SmallIcon, and the desired location of }
  636.             {    the upper left corner.                }
  637.             begin
  638.                 PlotBWSmallIcon(SmallIconHandle, Location);
  639.             end;
  640.  
  641.         {    Release the icon resource handle.    }
  642.         ReleaseResource(SmallIconHandle);
  643.  
  644.     end;
  645. {-------------------------------------------    }
  646. {    End of procedure PlotSmallIcon                            }
  647. {-------------------------------------------    }
  648.  
  649.  
  650. {*********************************************************************    }
  651. {*                                        L A R G E   I C O N   (iclx)  H A N D L I N G      M E T H O D S                                 *    }
  652. {*********************************************************************    }
  653.  
  654.  
  655. {-----------------------------------------------------------    }
  656. {    GetLargeIcon --                                                                            }
  657. {                                                                                                    }
  658. {        This function returns a handle the "deepest" possible Large    }
  659. {        icon it can find. This will be either a icl8, icl4, or ICN#.        }
  660. {        The function starts searching for the icon which coresponds    }
  661. {        to the "suggestedDepth" and, if not found, will search for        }
  662. {        a LargeIcon of the same ID, but lower depth.                            }
  663. {        EXAMPLE: The function is called, looking for a Large icon of    }
  664. {        ID=200. The suggestedDepth is 8. The function looks for a        }
  665. {        icl8 resource of ID=200. If found, its handle is returned. If    }
  666. {        it can't be located, the next logical depth to search is 4.            }
  667. {        Thus the function then looks for a icl4 of ID=200. If found,     }
  668. {        a handle to the icl4 is returned. If not found, on last attempt    }
  669. {        will be made to locate a usable LargeIcon. This time, the        }
  670. {        search will be for a depth of 1. Thus the function looks for        }
  671. {        a ICN# of ID=200. Again, if found, the handle to the icon is        }
  672. {        returned. If no LargeIcon is found, then a nil is returned.        }
  673. {-----------------------------------------------------------    }
  674.     function GetLargeIcon (LargeIconID: Integer; var suggestedDepth: Integer): Handle;
  675.         var
  676.             LargeIconH: Handle;
  677.             ActualDepth: Integer;
  678.     begin
  679.  
  680.         {    Prime the local variables.    }
  681.         LargeIconH := nil;
  682.         ActualDepth := suggestedDepth;
  683.  
  684.         {    If the suggested depth is 8 bits (or mistakenly more) then    }
  685.         {    search for an icl8 resource.                                                }
  686.         if suggestedDepth >= 8 then
  687.             begin
  688.                 LargeIconH := GetResource('icl8', LargeIconID);
  689.                 {    If the resource was indeed present, then }
  690.                 if LargeIconH <> nil then
  691.                     begin
  692.                         {    Make sure that the suggestedDepth is set to reflect the     }
  693.                         {    Large icons which was actually located.                            }
  694.                         suggestedDepth := 8;
  695.                     end
  696.                 else
  697.                     {    No icl8 resource could be found at the given ID. Thus, set    }
  698.                     {    set the suggestedDepth to the next lowest depth.                }
  699.                     suggestedDepth := 4;
  700.             end;
  701.  
  702.         {    If the suggested depth is 4 bits (or mistakenly 5-7), and no LargeIcon    }
  703.         {    has yet been located, then search for an icl4 resource.                        }
  704.         if ((suggestedDepth < 8) and (suggestedDepth >= 4) and (LargeIconH = nil)) then
  705.             begin
  706.                 LargeIconH := GetResource('icl4', LargeIconID);
  707.                 {    If the resource was indeed present, then }
  708.                 if LargeIconH <> nil then
  709.                     begin
  710.                         {    Make sure that the suggestedDepth is set to reflect the     }
  711.                         {    Large icons which was actually located.                            }
  712.                         suggestedDepth := 4;
  713.                     end
  714.                 else
  715.                     {    No icl4 resource could be found at the given ID. Thus, set    }
  716.                     {    set the suggestedDepth to the next lowest depth.                }
  717.                     suggestedDepth := 1;
  718.             end;
  719.  
  720.         {    If the suggested depth is 1 bit (or mistakenly 2-3), and no LargeIcon    }
  721.         {    has yet been located, then search for an ICN# resource.                        }
  722.         if ((suggestedDepth < 4) and (LargeIconH = nil)) then
  723.             begin
  724.                 LargeIconH := GetResource('ICN#', LargeIconID);
  725.                 {    If the resource was indeed present, then }
  726.                 if LargeIconH <> nil then
  727.                     begin
  728.                         {    Make sure that the suggestedDepth is set to reflect the     }
  729.                         {    Large icons which was actually located.                            }
  730.                         suggestedDepth := 1;
  731.                     end
  732.                 else
  733.                     {    No ICN# resource could be found at the given ID. Thus, set    }
  734.                     {    set the suggestedDepth to the next lowest depth.                }
  735.                     suggestedDepth := 0;
  736.             end;
  737.  
  738.         {    Return the handle to the LargeIcon.    }
  739.         {    If it is nil, then no LargeIcon was found. Also if this is    }
  740.         {    true, the suggestedDepth var parameter will be set to zero.    }
  741.         GetLargeIcon := LargeIconH;
  742.  
  743.     end;
  744. {-------------------------------------------    }
  745. {    End of function GetLargeIcon                                }
  746. {-------------------------------------------    }
  747.  
  748.  
  749.  
  750. {-----------------------------------------------------------    }
  751. {    PlotBWLargeIcon --                                                                    }
  752. {                                                                                                    }
  753. {        This procedure draws the ICN# member of a LargeIcon            }
  754. {        family. This drawing is done in the current grafPort, with        }
  755. {        the upper left corner of the LargeIcon being located at the        }
  756. {        desired point.                                                                        }
  757. {                                                                                                    }
  758. {    *    For Reference:                                                                        }
  759. {        An ICN# is a resource type which defines a 32 by 32 pixel     }
  760. {        black&white image of 1 bit depth, and thus a total of 128         }
  761. {        bytes. It is also followed by the ICN# mask or 128 bytes.        }
  762. {-----------------------------------------------------------    }
  763.     procedure PlotBWLargeIcon (BWLargeIcon: Handle; location: Point);
  764.         var
  765.             Bounds: Rect;
  766.             DestRect: Rect;
  767.             BWLargeIconBitMap: BitMap;
  768.  
  769.     begin
  770.  
  771.         { Determine the bounds and destination rect of the LargeIcon according to the passed in location parameter . }
  772.         SetRect(bounds, 0, 0, LargeIconSide, LargeIconSide);
  773.         SetRect(destRect, location.h, location.v, location.h + LargeIconSide, location.v + LargeIconSide);
  774.  
  775.         {    Lock down our LargeIcon.    }
  776.         HLock(BWLargeIcon);
  777.  
  778.         {    Prepare the LargeIcon Mask and destination bitmaps.    }
  779.         BWLargeIconBitMap.baseAddr := Ptr(LongInt(BWLargeIcon^) + 128);
  780.         BWLargeIconBitMap.rowBytes := 4;
  781.         BWLargeIconBitMap.bounds := Bounds;
  782.  
  783.         {    Transfer the mask of the B&W LargeIcon.    }
  784.         CopyBits(BWLargeIconBitMap, thePort^.PortBits, bounds, DestRect, srcBic, nil);
  785.  
  786.         {    Change the BitMap address pointer to get the ICN# image as apposed to the current mask.    }
  787.         BWLargeIconBitMap.baseAddr := Ptr(BWLargeIcon^);
  788.         {    Transfer the LargeIcon image.    }
  789.         CopyBits(BWLargeIconBitMap, thePort^.PortBits, bounds, DestRect, srcOr, nil);
  790.  
  791.         {    UnLock our LargeIcon.    }
  792.         HUnLock(BWLargeIcon);
  793.  
  794.     end;
  795. {-------------------------------------------    }
  796. {    End of procedure PlotBWLargeIcon                        }
  797. {-------------------------------------------    }
  798.  
  799.  
  800.  
  801. {-----------------------------------------------------------    }
  802. {    PlotCLargeIcon --                                                                        }
  803. {                                                                                                    }
  804. {    *    This procedure draws the "deepest" color Large icon it can.    }
  805. {        This is based on the determined depth of screen as well as        }
  806. {        available resources.                                                                }
  807. {    *    Once the Large icon is identified and loaded, it is transfered    }
  808. {        to a PixelMap of either 4 or 8 bit depth, depending on             }
  809. {        whether it is an icl4 or icl8.                                                    }
  810. {    *    The Large icon is drawn with its upper left corner situated    }
  811. {        at the desired location within the current grafCPort.                }
  812. {                                                                                                    }
  813. {    *    For Reference:                                                                        }
  814. {    *    An icl8 is a resource type which defines a 32 by 32 pixel         }
  815. {        color image of 8 bit depth, and thus a total of 1024 bytes.        }
  816. {    *    An icl4 is a resource type which defines a 32 by 32 pixel         }
  817. {        color image of 4 bit depth, and thus a total of 512 bytes.        }
  818. {    *    An ICN# is a resource type which defines a 16 by 16 pixel     }
  819. {        black&white image of 1 bit depth, and thus a total of 128         }
  820. {        bytes. It is also followed by the ICN# mask or 128 bytes.        }
  821. {-----------------------------------------------------------    }
  822.     procedure PlotCLargeIcon (CLargeIcon: Handle; LargeIconMaskID, Depth: integer; location: Point);
  823.         var
  824.             ScreenDepth: Integer;                        {    Holds the determined depth of the screen.    }
  825.             LargeIconDepth: Integer;                    {    Holds the highest found Large Icon depth (either 1,4, or 8)        }
  826.                                                                     {    If no Large Icon can be found, then this holds the value zero.    }
  827.             ColorLookUpTable: CTabHandle;            {    Holds our own color look-up table.    }
  828.             destRect: Rect;                                    {    The rect which holds the end location of the Large icon.    }
  829.             MaskIconHandle: Handle;                    {    The handle which holds the Large icon mask data.    }
  830.             LargeIconPixMap: PixMapHandle;        {    The color PixMap which holds the color image of the Large icon.    }
  831.             LargeIconBitMap: BitMap;                    {    The B&W bitMap which holds the B&W image of the Large icon.    }
  832.             MaskBitMap: BitMap;                        {    The B&W bitMap which holds the mask of the Large icon.    }
  833.             bounds: Rect;                                    {    The rect which defines the bounds of the Large icon.    }
  834.             rowBytes: integer;                            {    Used to hold the calculation of the number of bytes in a row of the Large icon.    }
  835.             aBitMapPtr: BitMapPtr;                    {    A smecial type used to coerce the PixMap into looking like a BitMap.    }
  836.  
  837.  
  838.     {------------------------------    }
  839.     {    Set up failure handler.                }
  840.     {------------------------------    }
  841.         procedure HandleFailure (error: Integer);
  842.         begin
  843.  
  844.             {    Take care of disposal or release of all handles allocated by us.    }
  845.  
  846.             if ColorLookUpTable <> nil then
  847.                 DisposeCTable(ColorLookUpTable);
  848.  
  849.             if CLargeIcon <> nil then
  850.                 HUnLock(CLargeIcon);
  851.  
  852.             if MaskIconHandle <> nil then
  853.                 ReleaseResource(MaskIconHandle);
  854.  
  855.             if LargeIconPixMap <> nil then
  856.                 begin
  857.                     LargeIconPixMap^^.baseAddr := nil;
  858.                     DisposPixMap(LargeIconPixMap);
  859.                 end;
  860.  
  861.             Exit(PlotCLargeIcon);
  862.         end;
  863.     {------------------------------    }
  864.     {    End of failure handler.                }
  865.     {------------------------------    }
  866.  
  867.     begin
  868.  
  869.         {    Initialize all of our handles so that error handling is assured of working.    }
  870.         ColorLookUpTable := nil;
  871.         MaskIconHandle := nil;
  872.         LargeIconPixMap := nil;
  873.  
  874.         {    Check to make sure that a LargeIcon was indeed able to be found.    }
  875.         if CLargeIcon = nil then
  876.             HandleFailure(resNotFound);
  877.         {    Lock down our icon.    }
  878.         HLock(CLargeIcon);
  879.  
  880.         { Determine the bounds and destination rect of the LargeIcon according to the passed in location parameter . }
  881.         SetRect(bounds, 0, 0, LargeIconSide, LargeIconSide);
  882.         SetRect(destRect, location.h, location.v, location.h + LargeIconSide, location.v + LargeIconSide);
  883.  
  884.         {    Get the mask data.        }
  885.         MaskIconHandle := GetResource('ICN#', LargeIconMaskID);
  886.         {    Check to make sure that a LargeIcon mask was indeed able to be found.    }
  887.         if MaskIconHandle = nil then
  888.             HandleFailure(resNotFound);
  889.         {    Lock down our mask.    }
  890.         HLock(MaskIconHandle);
  891.  
  892.             {    Handle the plotting of a color LargeIcon.    }
  893.  
  894.         {    Get the correct lookup table according to the depth of the LargeIcon.    }
  895.         ColorLookUpTable := GetCTable(Depth);
  896.         {    Check to see if the color lookUp table could be created.    }
  897.         if ColorLookUpTable = nil then
  898.             HandleFailure(memFullErr);
  899.  
  900.         {    Create a pixmap to stick the icon bits into for screen blitting.    }
  901.         LargeIconPixMap := NewPixMap;
  902.         {    Check to see if there was enough memory to create the new PixMap.    }
  903.         if LargeIconPixMap = nil then
  904.             HandleFailure(memFullErr);
  905.  
  906.         {    Set up the color pixmap with the correct bounds, depth, and clut.    }
  907.         rowBytes := (((Depth * LargeIconSide) + 15) div 16) * 2;
  908.         LargeIconPixMap^^.baseAddr := Ptr(CLargeIcon^);
  909.         LargeIconPixMap^^.rowBytes := BOR(rowBytes, $8000);
  910.         LargeIconPixMap^^.bounds := bounds;
  911.         LargeIconPixMap^^.pixelType := 0;                                {    Chunky model.    }
  912.         LargeIconPixMap^^.pixelSize := Depth;
  913.         LargeIconPixMap^^.cmpCount := 1;                                {    If in 32 bit mode this will be 3, so must change.    }
  914.         LargeIconPixMap^^.cmpSize := Depth;                            {    Only chunky images used.    }
  915.         DisposeCTable(LargeIconPixMap^^.pmTable);                    {    Dispose of default, uninitialized table.    }
  916.         LargeIconPixMap^^.pmTable := ColorLookUpTable;
  917.  
  918.         {    Prepare the LargeIcon mask.    }
  919.         MaskBitMap.baseAddr := Ptr(LongInt(MaskIconHandle^) + 128);
  920.         MaskBitMap.rowBytes := 4;
  921.         MaskBitMap.bounds := bounds;
  922.  
  923.         {    Punch out the mask.    }
  924.         CopyBits(MaskBitMap, thePort^.portBits, bounds, destRect, srcBic, nil);
  925.  
  926.         {    Draw the actual icon.    }
  927.         HLock(Handle(LargeIconPixMap));
  928.         {    In order to do this, we must disguise our PixMap as a BitMap.    }
  929.         aBitMapPtr := BitMapPtr(LargeIconPixMap^);
  930.         CopyBits(aBitMapPtr^, thePort^.portBits, bounds, destRect, srcOr, nil);
  931.  
  932.         {    Release all that we have allocated.    }
  933.         LargeIconPixMap^^.baseAddr := nil;
  934.         DisposPixMap(LargeIconPixMap);
  935.  
  936.         {    Release the mask resource handle.    }
  937.         ReleaseResource(MaskIconHandle);
  938.  
  939.         {    Unlock our icon handle.    }
  940.         HUnLock(CLargeIcon);
  941.  
  942.     end;
  943. {-------------------------------------------    }
  944. {    End of procedure PlotCLargeIcon                        }
  945. {-------------------------------------------    }
  946.  
  947.  
  948. {-----------------------------------------------------------    }
  949. {    PlotLargeIcon --                                                                        }
  950. {                                                                                                    }
  951. {    *    This procedure draws the "deepest" Large icon it can.            }
  952. {        This is based on the determined depth of screen as well as        }
  953. {        available resources.                                                                }
  954. {    *    Once identified, the LargeIcon is drawn by either the                }
  955. {        PlotBWLargeIcon or PlotCLargeIcon procedures.                        }
  956. {                                                                                                    }
  957. {-----------------------------------------------------------    }
  958.     procedure PlotLargeIcon (LargeIconID, DesiredDepth: integer; Location: Point);
  959.         var
  960.             ScreenDepth: Integer;                        {    Holds the determined depth of the screen.    }
  961.             LargeIconDepth: Integer;                    {    Holds the highest found Large Icon depth (either 1,4, or 8)        }
  962.                                                                     {    If no Large Icon can be found, then this holds the value zero.    }
  963.             LargeIconHandle: Handle;                    {    The handle which holds the Large icon data.    }
  964.  
  965.     {------------------------------    }
  966.     {    Set up failure handler.                }
  967.     {------------------------------    }
  968.         procedure HandleFailure (error: Integer);
  969.         begin
  970.  
  971.             {    Take care of disposal or release of all handles allocated by us.    }
  972.  
  973.             if LargeIconHandle <> nil then
  974.                 ReleaseResource(LargeIconHandle);
  975.  
  976.             Exit(PlotLargeIcon);
  977.         end;
  978.     {------------------------------    }
  979.     {    End of failure handler.                }
  980.     {------------------------------    }
  981.  
  982.     begin
  983.  
  984.         {    Initialize all of our handles so that error handling is assured of working.    }
  985.         LargeIconHandle := nil;
  986.  
  987.         {    Determine the depth of the screen.    }
  988.         ScreenDepth := GetScreenDepth;
  989.  
  990.         {    Now attempt to find the highest depth LargeIcon available.    }
  991.         LargeIconDepth := ScreenDepth;
  992.         LargeIconHandle := GetLargeIcon(LargeIconID, LargeIconDepth);
  993.         {    Check to make sure that a LargeIcon was indeed able to be found.    }
  994.         if LargeIconHandle = nil then
  995.             HandleFailure(resNotFound);
  996.  
  997.         {    Now we must differentiate between the plotting of a Black&White    }
  998.         {    LargeIcon and a color LargeIcon.                                                        }
  999.         if LargeIconDepth > 1 then
  1000.  
  1001.             {    Handle the plotting of a color LargeIcon.    }
  1002.             {    We must send the handle to the LargeIcon, the resID of the LargeIcon's    }
  1003.             {    mask (which is the ICN# ID), the depth of the LargeIcon (which is            }
  1004.             {    either 4 or 8), and the desired location of the upper left corner.                }
  1005.             begin
  1006.                 PlotCLargeIcon(LargeIconHandle, LargeIconID, LargeIconDepth, Location);
  1007.             end
  1008.  
  1009.         else
  1010.  
  1011.             {    Handle the plotting of a black&White LargeIcon.    }
  1012.             {    We must send the handle to the LargeIcon, and the desired location of }
  1013.             {    the upper left corner.                }
  1014.             begin
  1015.                 PlotBWLargeIcon(LargeIconHandle, Location);
  1016.             end;
  1017.  
  1018.         {    Release the icon resource handle.    }
  1019.         ReleaseResource(LargeIconHandle);
  1020.  
  1021.     end;
  1022. {-------------------------------------------    }
  1023. {    End of procedure PlotLargeIcon                            }
  1024. {-------------------------------------------    }
  1025.  
  1026.  
  1027. {-----------------------------------------------------------    }
  1028. {    End of the utility unit ResForkUtilities                                        }
  1029. {-----------------------------------------------------------    }
  1030. end.